
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Locale;

/**
 * @author 王硕
 * @version jdk21
 * @className ${NAME}
 * @description
 * @date 2024/11/18 10:33
 */  //TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
public class Main {
    public static void main(String[] args) {
            demo12();
        }

    private static void demo12() {

    }

    private static void demo11() {
        String str1="h";
        String str2="e";
        String str3="l";
        String str4="l";
        String str5="o";
        //String str6=str1+"-"+str2+"-"+str3+"-"+str4+"-"+str5;
        //System.out.println(str6);
        String concat = str1.concat("-").concat(str2);
        System.out.println(concat);
        String string = String.join("-",str1,str2,str3,str4,str5);
        System.out.println(String.join("-",str1,str2,str3,str4,str5));
    }

    private static void demo10() {
        String username = " a dm in  ";
        System.out.println(username.trim());
        System.out.println(username.strip());
        System.out.println(username.stripLeading());
        System.out.println(username.stripTrailing());
    }

    private static void demo9() {
        String string = "abcDDDasdabcdsad";
        System.out.println(string.toUpperCase());
    }

    private static void demo8() {
        String string = "abcdasdabcdsad";
        System.out.println(string.substring(3,5));
    }

    private static void demo7() {
        String str = "hello";
        for (int index = 0; index < str.length(); index++) {
            System.out.println(str.charAt(index));
        }
    }

    private static void demo6() {
        String str = "hellol00000l";
        System.out.println(str.indexOf("9"));
        System.out.println(str.lastIndexOf("",10));
    }

    private static void demo5() {
        String str = "abcdabcjabjjabjkabab";
        String[] array = str.split("ab",9);
        System.out.println(Arrays.toString(array));
    }

    private static void demo4() {
        String string = "孙雪怡最美";
        char[] chars = string.toCharArray();
        for (char aChar : chars) {
            System.out.println(aChar);
        }
    }

    private static void demo3() {
        String str = new String("孙雪怡最漂亮了");
        byte[] bytes = str.getBytes(Charset.forName("GBK"));
        System.out.println(Arrays.toString(bytes));
    }

    private static void demo2() {
        char[] chars = {97, 100, 'a', '1', '王'};
        String string = new String(chars);
        System.out.println(string);
        String s1 = new String(chars, 2, 3);
        System.out.println(s1);
    }

    private static void demo1() {
        byte[] bytes = {-27, -83, -103, -23, -101, -86, -26, -128, -95, -26,
                -100, -128, -26, -68, -126, -28, -70, -82, -28, -70, -122};
        String string = new String(bytes);
        System.out.println(string);
    }
    }



